<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Form extends CI_Controller {
    
	function __construct() 
	{
		parent::__construct();
                $this->load->model('dbase');
            $this->load->helper(array('form', 'url'));
            $this->load->library('form_validation');
	}
        
        function create_team()
        {
            $this->form_validation->set_rules('title', 'Title', 'required');
            $this->form_validation->set_rules('text', 'Text', 'required');
            
            if($this->form_validation->run() == FALSE)
            {
                $this->load-view('create_team');
            } else {
                $this->dbase->create_team($this->input->post('title'), $this->input->post('description'), $this->input->post('avatar'));
            }
        }
        
        function post_news()
        {
            $this->form_validation->set_rules('title', 'Title', 'required');
            $this->form_validation->set_rules('text', 'Text', 'required');
            
            if($this->form_validation->run() == FALSE)
            {
                $this->load->view('admin/news');
            } else {
                $this->dbase->post_News($this->input->post('title'), $this->input->post('text'));
                $this->load->view('admin/post_news');
            }
            
        }
}

/* End of file form.php */
/* Location: ./application/controllers/form.php */
